package com.czkevin.exampleplugin;

import org.bukkit.ChatColor;
import org.bukkit.entity.Chicken;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.plugin.java.JavaPlugin;

public class TestPlugin extends JavaPlugin implements Listener {

    @Override
    public void onEnable() {
        getLogger().info("Plugin enabled!");
        getServer().getPluginManager().registerEvents(this, this);
    }
    
    @EventHandler
    public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
        if (event.getEntity().getType() == EntityType.CHICKEN && event.getDamager() instanceof Player) {
            Player player = (Player) event.getDamager();
            player.getWorld().strikeLightning(event.getEntity().getLocation());
            player.sendTitle(ChatColor.RED + "鸡" + ChatColor.GOLD + "你" + ChatColor.YELLOW + "太" + ChatColor.GREEN + "美", "");
        }
    }
}
